<template>
  <div class></div>
</template>
<script>
import axios from "@/utils/requestdp";
import dayjs from 'dayjs';

export default {
  name: "APIjinrijihuareliang",
  components: {},
  data() {
    return {};
  },
  computed: {
    ishistory: function() {
      return this.$store.state.daping.ishistorytime;
    },
    timerangarr: function() {
      return this.$store.state.daping.timepick;
    }
  },
  watch: {},
  mounted() {
    this.watchEvent();
  },
  methods: {
    watchEvent() {
      //先清除定时任务
      if (
        this.$store.state.daping.intervalArr["APIjinrijihuareliang"] != undefined
      ) {
        clearInterval(
          this.$store.state.daping.intervalArr["APIjinrijihuareliang"][0].interval
        );
      }
      this.loadData();
      let interval = setInterval(() => {
        this.loadData();
      }, this.$root.setting.data.interval);
      this.$store.state.daping.intervalArr["APIjinrijihuareliang"] = [
        { interval: interval }
      ];
    },
    loadData() {
      // 今日计划热量接口暂无
      axios.get(`heatPlan/planData`).then(res => {
        if (res.code == 200 && res.data.length != 0) {
          this.$store.state.daping.jinrijihuareliang = res.data[0].totalPlanHeat;
        } else {
          this.$store.state.daping.jinrijihuareliang = 0;
        }
      //   let data = res.rows;
      //   this.$store.state.daping.jinrijihuareliang = data;
      });

    }
  }
};
</script>
<style lang='scss' scoped>
</style>